/*
 * VentanaNuevoEstadoAnimo.java
 *
 * Created on 18 de septiembre de 2008, 08:58
 */

package vista;

//import controlador.ControladorAlta;
//import controlador.ControladorConsulta;
//import dominio.EstadoAnimo;
import dominio.EstadoAnimo;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.util.ArrayList;
import java.util.Collection;
//import java.util.Iterator;
import javax.swing.JOptionPane;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableColumn;
import vista.util.VentanaNuevoEstadoAnimoUtil;

/**
 *
 * @author  marcelo
 */
public class VentanaNuevoEstadoAnimo extends javax.swing.JFrame 
{

    private Collection estados = new ArrayList();
    private VentanaNuevoEstadoAnimoUtil util = new VentanaNuevoEstadoAnimoUtil();
    private boolean seleccionado = false;
    private boolean origen;
    
    /** Creates new form VentanaNuevoEstadoAnimo */
    public VentanaNuevoEstadoAnimo()
    {
        initComponents();
        this.inicializar();
        this.origen = false;
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel3 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jTextFieldNombre = new javax.swing.JTextField();
        jPanel1 = new javax.swing.JPanel();
        jSliderTemperaturaMinima = new javax.swing.JSlider();
        jLabelTemperaturaMinima = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jSliderTemperaturaMaxima = new javax.swing.JSlider();
        jLabelTemperaturaMaxima = new javax.swing.JLabel();
        jScrollPane2 = new javax.swing.JScrollPane();
        jTableEstados = new javax.swing.JTable();
        jButtonGuardar = new javax.swing.JButton();
        jButtonLimpiar = new javax.swing.JButton();
        jButtonSalir = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
        setTitle("Nuevo Estado de Animo");

        jPanel3.setBorder(javax.swing.BorderFactory.createTitledBorder("Nueva"));

        jLabel2.setBackground(new java.awt.Color(255, 255, 204));
        jLabel2.setText("Nombre");
        jLabel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());
        jLabel2.setOpaque(true);

        jPanel1.setBorder(javax.swing.BorderFactory.createTitledBorder("Temeperatura Minima"));

        jSliderTemperaturaMinima.setMajorTickSpacing(5);
        jSliderTemperaturaMinima.setMaximum(50);
        jSliderTemperaturaMinima.setMinorTickSpacing(1);
        jSliderTemperaturaMinima.setPaintLabels(true);
        jSliderTemperaturaMinima.setPaintTicks(true);
        jSliderTemperaturaMinima.setValue(25);
        jSliderTemperaturaMinima.setBorder(javax.swing.BorderFactory.createTitledBorder("Temperatura"));
        jSliderTemperaturaMinima.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jSliderTemperaturaMinimaStateChanged(evt);
            }
        });

        jLabelTemperaturaMinima.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabelTemperaturaMinima.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTemperaturaMinima.setText("25");
        jLabelTemperaturaMinima.setBorder(javax.swing.BorderFactory.createTitledBorder("Temperatura"));

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jSliderTemperaturaMinima, javax.swing.GroupLayout.PREFERRED_SIZE, 304, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel1Layout.createSequentialGroup()
                        .addGap(110, 110, 110)
                        .addComponent(jLabelTemperaturaMinima, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jSliderTemperaturaMinima, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jLabelTemperaturaMinima, javax.swing.GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE)
                .addContainerGap())
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createTitledBorder("Temeperatura Maxima"));

        jSliderTemperaturaMaxima.setMajorTickSpacing(5);
        jSliderTemperaturaMaxima.setMaximum(50);
        jSliderTemperaturaMaxima.setMinorTickSpacing(1);
        jSliderTemperaturaMaxima.setPaintLabels(true);
        jSliderTemperaturaMaxima.setPaintTicks(true);
        jSliderTemperaturaMaxima.setValue(25);
        jSliderTemperaturaMaxima.setBorder(javax.swing.BorderFactory.createTitledBorder("Temperatura"));
        jSliderTemperaturaMaxima.addChangeListener(new javax.swing.event.ChangeListener() {
            public void stateChanged(javax.swing.event.ChangeEvent evt) {
                jSliderTemperaturaMaximaStateChanged(evt);
            }
        });

        jLabelTemperaturaMaxima.setFont(new java.awt.Font("Tahoma", 0, 18));
        jLabelTemperaturaMaxima.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        jLabelTemperaturaMaxima.setText("25");
        jLabelTemperaturaMaxima.setBorder(javax.swing.BorderFactory.createTitledBorder("Temperatura"));

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jSliderTemperaturaMaxima, javax.swing.GroupLayout.PREFERRED_SIZE, 304, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addGap(113, 113, 113)
                        .addComponent(jLabelTemperaturaMaxima, javax.swing.GroupLayout.PREFERRED_SIZE, 94, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addComponent(jSliderTemperaturaMaxima, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(jLabelTemperaturaMaxima, javax.swing.GroupLayout.DEFAULT_SIZE, 62, Short.MAX_VALUE)
                .addContainerGap())
        );

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(jPanel3Layout.createSequentialGroup()
                        .addGap(194, 194, 194)
                        .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 60, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(jTextFieldNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 245, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addContainerGap())
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jTextFieldNombre, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(11, 11, 11)
                .addGroup(jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        jTableEstados.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null},
                {null, null, null, null}
            },
            new String [] {
                "Codigo", "Nombre", "Temp. Minima", "Temp. Maxima"
            }
        ) {
            boolean[] canEdit = new boolean [] {
                false, false, false, false
            };

            public boolean isCellEditable(int rowIndex, int columnIndex) {
                return canEdit [columnIndex];
            }
        });
        jTableEstados.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jTableEstadosMouseClicked(evt);
            }
        });
        jTableEstados.addKeyListener(new java.awt.event.KeyAdapter() {
            public void keyPressed(java.awt.event.KeyEvent evt) {
                jTableEstadosKeyPressed(evt);
            }
        });
        jScrollPane2.setViewportView(jTableEstados);

        jButtonGuardar.setText("Guardar");
        jButtonGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonGuardarActionPerformed(evt);
            }
        });

        jButtonLimpiar.setText("Modificar");
        jButtonLimpiar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonLimpiarActionPerformed(evt);
            }
        });

        jButtonSalir.setText("Salir");
        jButtonSalir.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButtonSalirActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(jPanel3, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                            .addComponent(jScrollPane2, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 728, Short.MAX_VALUE))
                        .addContainerGap())
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jButtonGuardar, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(79, 79, 79)
                        .addComponent(jButtonLimpiar, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(83, 83, 83)
                        .addComponent(jButtonSalir, javax.swing.GroupLayout.PREFERRED_SIZE, 90, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(162, 162, 162))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 204, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jButtonLimpiar)
                    .addComponent(jButtonGuardar)
                    .addComponent(jButtonSalir))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void jButtonSalirActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonSalirActionPerformed
// TODO add your handling code here:
    this.dispose();
}//GEN-LAST:event_jButtonSalirActionPerformed

private void jButtonGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonGuardarActionPerformed
// TODO add your handling code here:
    this.guardar();
}//GEN-LAST:event_jButtonGuardarActionPerformed

private void jSliderTemperaturaMinimaStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSliderTemperaturaMinimaStateChanged
// TODO add your handling code here:
    this.jLabelTemperaturaMinima.setText(String.valueOf(this.jSliderTemperaturaMinima.getValue()));
}//GEN-LAST:event_jSliderTemperaturaMinimaStateChanged

private void jSliderTemperaturaMaximaStateChanged(javax.swing.event.ChangeEvent evt) {//GEN-FIRST:event_jSliderTemperaturaMaximaStateChanged
// TODO add your handling code here:
    this.jLabelTemperaturaMaxima.setText(String.valueOf(this.jSliderTemperaturaMaxima.getValue()));
}//GEN-LAST:event_jSliderTemperaturaMaximaStateChanged

private void jButtonLimpiarActionPerformed(java.awt.event.ActionEvent evt)//GEN-FIRST:event_jButtonLimpiarActionPerformed
{//GEN-HEADEREND:event_jButtonLimpiarActionPerformed
    // TODO add your handling code here:
    this.modificar();
}//GEN-LAST:event_jButtonLimpiarActionPerformed

private void jTableEstadosMouseClicked(java.awt.event.MouseEvent evt)//GEN-FIRST:event_jTableEstadosMouseClicked
{//GEN-HEADEREND:event_jTableEstadosMouseClicked
    // TODO add your handling code here:
    this.seleccionado = true;
    this.seleccionarFila();
}//GEN-LAST:event_jTableEstadosMouseClicked

private void jTableEstadosKeyPressed(java.awt.event.KeyEvent evt)//GEN-FIRST:event_jTableEstadosKeyPressed
{//GEN-HEADEREND:event_jTableEstadosKeyPressed
    // TODO add your handling code here:
    if(evt.getKeyCode() == 127)
        this.eliminar();
}//GEN-LAST:event_jTableEstadosKeyPressed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new VentanaNuevoEstadoAnimo().setVisible(true);
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonGuardar;
    private javax.swing.JButton jButtonLimpiar;
    private javax.swing.JButton jButtonSalir;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabelTemperaturaMaxima;
    private javax.swing.JLabel jLabelTemperaturaMinima;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JSlider jSliderTemperaturaMaxima;
    private javax.swing.JSlider jSliderTemperaturaMinima;
    private javax.swing.JTable jTableEstados;
    private javax.swing.JTextField jTextFieldNombre;
    // End of variables declaration//GEN-END:variables

    
    private void inicializar()
    {
        this.centrar();
        this.ajustarTamanioColumna();
        this.limpiar();
        this.cargarTabla();
    }
    private void centrar()
    {
        Dimension pantalla, cuadro;
	pantalla = Toolkit.getDefaultToolkit().getScreenSize();
	cuadro = this.getSize();
	this.setLocation(((pantalla.width - cuadro.width)/2), (pantalla.height - cuadro.height)/2);
    }
    
    private void ajustarTamanioColumna()
    {
        TableColumn column = null;
        for (int i = 0; i < 4; i++)
        {
            column = jTableEstados.getColumnModel().getColumn(i);
            switch(i)
            {
                case 0:
                        column.setPreferredWidth(15);
//                        System.out.println(column.getPreferredWidth());
                        break;
                case 1:
                        column.setPreferredWidth(290);
//                        System.out.println(column.getPreferredWidth());
                        break;
                case 2:
                        column.setPreferredWidth(70);
//                        System.out.println(column.getPreferredWidth());
                        break;
                case 3:
                        column.setPreferredWidth(69);
//                        System.out.println(column.getPreferredWidth());
                        break;
            }
        }
    }

    /**
     * Metodo que trae datos de la base de datos y los carga en el grid.
     */
    private void cargarTabla()
    {
        this.estados = this.util.traerTodos(this.jTableEstados, this.estados);
    }

    /**
     * este metodo se encarga de guardar el nuevo estilo de musica ingresado por el usuario.
     * Basicamente comprende 2 procesos:
     * 1)_ Controlar que todos los campos solicitados esten cargados.
     * 2)_ Guardar el nuevo registro.
     */
    private void guardar ()
    {
        if (this.verificaBlancos()) // verifica si todos los campos estan cargados
        {
            EstadoAnimo e = new EstadoAnimo();
            e.setNombre(this.jTextFieldNombre.getText().trim().toUpperCase());
            e.setTempMax(this.jSliderTemperaturaMaxima.getValue());
            e.setTempMin(this.jSliderTemperaturaMinima.getValue());
            this.util.nuevoEstadoAnimo(e);
            
            this.jTextFieldNombre.setText("");
            this.jTextFieldNombre.requestFocus();
            this.jSliderTemperaturaMaxima.setValue(25);
            this.jSliderTemperaturaMinima.setValue(25);
            this.limpiar();
            this.cargarTabla();
        }
        else
            JOptionPane.showMessageDialog(null, "Asegurese de que los campos esten llenos","Hay campos en blancos",JOptionPane.ERROR_MESSAGE);
    }

    /**
     * Metodo para limpiar los registros de la tabla.
     * Quita todas las filas de la tabla.
     */
    private void limpiar()
    {
        DefaultTableModel modelo = (DefaultTableModel)this.jTableEstados.getModel();
        while(this.jTableEstados.getRowCount() != 0)
                modelo.removeRow(0);
        modelo = null;
    }
    
    
     ////////////// GUARDAR REGISTRO /////////////////////
    
    private boolean verificaBlancos ()
    {
     boolean bandera = true;
     String var;
     var= this.jTextFieldNombre.getText();
     if ( var.trim().length()== 0)
         bandera = false;
     return bandera;
    }

    private void modificar()
    {
        if(this.verificaBlancos() && this.seleccionado)
        {
            this.util.modificarEstadoAnimo(this.getEstado());
            this.jTextFieldNombre.setText("");
            this.jSliderTemperaturaMaxima.setValue(25);
            this.jSliderTemperaturaMinima.setValue(25);
            this.limpiar();
            this.cargarTabla();
        }
        else
            JOptionPane.showMessageDialog(null, "Debe seleccionar un estado de animo para modificar","No hay tema selecionado",JOptionPane.ERROR_MESSAGE);
    }

    private EstadoAnimo getEstado()
    {
        int codigo = Integer.parseInt(String.valueOf(this.jTableEstados.getValueAt(this.jTableEstados.getSelectedRow(), 0)));
        EstadoAnimo e = new EstadoAnimo();
        e.setCodigo(codigo);
        e.setTempMax(this.jSliderTemperaturaMaxima.getValue());
        e.setTempMin(this.jSliderTemperaturaMinima.getValue());
        e.setNombre(this.jTextFieldNombre.getText().trim().toUpperCase());
        return e;
    }

    ///////////////////////////////// mostrar datos seleccionados del grid

    private void seleccionarFila()
    {
        this.jTextFieldNombre.setText(String.valueOf(this.jTableEstados.getValueAt(this.jTableEstados.getSelectedRow(), 1)));
        this.jSliderTemperaturaMaxima.setValue((int)Double.parseDouble(String.valueOf(this.jTableEstados.getValueAt(this.jTableEstados.getSelectedRow(), 3))));
        this.jSliderTemperaturaMinima.setValue((int)Double.parseDouble(String.valueOf(this.jTableEstados.getValueAt(this.jTableEstados.getSelectedRow(), 2))));
    }


    private void eliminar()
    {
        if(this.verificaBlancos())
        {
            this.util.eliminarEstadoAnimo(this.getEstado());
            this.jTextFieldNombre.setText("");
            this.jSliderTemperaturaMaxima.setValue(25);
            this.jSliderTemperaturaMinima.setValue(25);
            this.limpiar();
            this.cargarTabla();
        }
        else
            JOptionPane.showMessageDialog(null, "Debe seleccionar un estado de animo para eliminar","No hay estado de animo selecionado",JOptionPane.ERROR_MESSAGE);
    }
    
}
